package com.donn.securitycontrolplatform.common;


import com.donn.securitycontrolplatform.emum.RESULT_CODE;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private int code;//编码 404 200
    private String msg;//提示信息
    private Object data; //数据

    public static Result init(int code, String msg, Object data) {
        Result result = new Result(code, msg, data);
        return result;
    }

    public static Result init(RESULT_CODE code) {
        Result result = new Result(code.getCode(), code.getMessage(), "");
        return result;
    }

    public static Result success(Object data) {
        Result result = new Result(200, "ok", data);
        return result;
    }
}
